package com.sike.netty.im.client.event;

import java.util.HashMap;
import java.util.Map;


/**
 * 事件工厂
 *
 * @author chenssy
 * @date 2023/09/16
 */
public class EventFactory {
    public static Map<String,CustomEvent> customEventMap = new HashMap<>();

    static {
        customEventMap.put(EventTypeEnum.ONE_CHAT_EVENT.getEvent(), new OneChatEvent());
        customEventMap.put(EventTypeEnum.MAIN_MENU_EVENT.getEvent(), new MainMenuEvent());
        customEventMap.put(EventTypeEnum.CREATE_GROUP_EVENT.getEvent(), new CreateGroupEvent());
        customEventMap.put(EventTypeEnum.JOIN_GROUP_EVENT.getEvent(), new JoinGroupEvent());
        customEventMap.put(EventTypeEnum.LIST_GROUP_MEMBERS_EVENT.getEvent(), new ListGroupMembersEvent());
        customEventMap.put(EventTypeEnum.EXIT_GROUP_EVENT.getEvent(), new ExitGroupEvent());
        customEventMap.put(EventTypeEnum.GROUP_CHAT_EVENT.getEvent(), new GroupChatEvent());
    }


    /**
     * 获取自定义事件
     *
     * @param event 事件
     * @return 自定义事件
     */
    public static CustomEvent getCustomEvent(String event) {
        return customEventMap.get(event);
    }
}
